package homework.demo;

public class Book {
    private String bookName;
    private String author;
    private static float price;
    private String publish;

    public Book(String bookName,String author, String publish,float price){
        this.bookName=bookName;
        this.author=author;
        this.publish=publish;
        setPrice(price);
        System.out.println("构造方法");

    }

    {
        System.out.println("构造块");
    }
    static {
        System.out.println("我是静态方法");

    }

    private void showMesg(){
        System.out.println("书名："+this.bookName);
        System.out.println("作者："+this.author);
        System.out.println("出版社："+this.publish);
        System.out.println("价格："+ getPrice());
    }
    public void show(){
        showMesg();
    }

    public String getAuthor() {
        return author;
    }

    public static float getPrice() {
        return price;
    }
    public static void setPrice(float price) {
        if (price<=10){
           Book.price=10;
        }else {
        Book.price = price;}
    }

    public String getPublish() {
        return publish;
    }

    public void setPublish(String publish) {
        this.publish = publish;
    }
    public static void main(String[] args) {
        System.out.println("main");
        Book book =new Book("aa","aad","ddd",134);


    }
}
